<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('办免训管理')" />
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" />

</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!-- header -->
    <div th:replace="~{commons/header::header}"></div>

    <!-- left -->
    <div th:replace="~{commons/studentLeft::left}"></div>
    <div class="layui-body">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "common/train";
    console.log(ctx)
    $(function() {
        var options = {
            url: prefix + "/list",
            updateUrl: prefix + "/edit/{id}/{stuId}",
            modalName: "办免训",
            columns: [{
                checkbox: true
            },
                {
                    field: 'stuId',
                    title: '学号',
                    align: "center"
                },
                {
                    field: 'stuName',
                    title: '姓名',
                    align: "center"
                },
                {
                    field: 'stuSex',
                    title: '性别',
                    align: "center"

                },
                {
                    field: 'trainColloge',
                    title: '院系',
                    align: "center",
                },
                {
                    field: 'trainClass',
                    title: '班级',
                    align: "center"
                },
                {
                    field: 'comeGrade',
                    title: '年级',
                    align: "center"
                },

                {
                    field: 'trainParentPhone',
                    title: '家长联系方式',
                    align: "center"
                },

                {
                    field: 'trainStuPhone',
                    title: '学生联系方式',
                    align: "center"
                },

                {
                    field: 'trainReason',
                    title: '免训原因',
                    align: "center"
                },
                {
                    field: 'status',
                    title: '办理状态',
                    align: "center",
                    formatter: function (value, row, index) {
                        return setStatus(row);
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    align: "center"
                },
                {
                    field: 'id',
                    title: 'id',
                    visible:false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs  " href="javascript:void(0)" onclick="$.operate.editFullPer(\'' + ($.common.isNotEmpty(row.id)?row.id:999999) + '\',\''+ row.stuId+'\')"><i class="fa fa-edit"></i>编辑</a> ');
                        return actions.join('');
                    }
                }

            ]
        };
        $.table.init(options);
    });
    /* 商品类别*/
    function setStatus(row) {
        if (row.status == 0) {
            return '<span class=\"btn btn-success btn-xs \">待审核</span> ';
        } else if(row.status == 1){
            return '<span class=\"btn btn-default btn-xs\">审核成功</span> ';
        }
        else if(row.status == 2){
            return '<span class=\"btn btn-warning btn-xs\">审核失败</span> ';
        }

    }
</script>
</body>
</html>
